<template>
	<view class="body">
		<view class="title-box" @click="back()">
			<!-- <view class="title">荷式拍卖列表</view> -->
			<text class="iconfont icon-left"></text>
		</view>
		<view class="item">
			<view class="title" style="display: flex;">
				入驻商铺名<span style="color: #D70000; display: block;">*</span>
			</view>
			<view class="in-ys">
				<input disabled="true" style="border: 0px;" placeholder="请输入入驻原因" border="none" v-model="shop.name" />
			</view>
		</view>
		<view class="item">
			<view class="title" style="width: 6rem;display: flex;">
				入驻商铺介绍<span style="color: #D70000; display: block;">*</span>
			</view>
			<view class="in-ys">
				<input :disabled="disable" style="border: 0px;" type="text" placeholder="请输入入驻原因" border="none" v-model="shop.intro" />
			</view>
		</view>
		<view class="button" @click="submit()" v-if="user.status ==2">提交</view>
		<view class="button" @click="back()" v-else>返回</view>
	</view>
</template>

<script>
	import apis from '@/api/index.js'
	import {
		requestApi,
		uphttp
	} from '@/utils/request.js'
	// 导入公共组件方法
	import common from '@/common/js/common.js';
	export default {
		data() {
			return {
				shop:{},
				user:{},
				disable:false
				
			}
		},
		onLoad() {
		this.user = uni.getStorageSync("user");
		if(this.user.status == 2){
			this.disable = false;
		}else{
			this.disable = true;
		}
		this.info()	
		},
		methods: {
			info(){
				requestApi(apis.shop.userinfo,this.user,'post').then(res=>{
					this.shop = res.data
					if(this.shop.name != null){
						this.disable = true;
					}
				})
			},
			submit(){
				requestApi(apis.shop.add,this.shop,'post').then(res=>{
					console.log(res);
					if(res.code == 200){
						uni.showToast({
							icon: "none",
							title: "提交成功"
						})
						setTimeout(()=>{
						uni.navigateTo({
							url:"/pages/center/center"
						})	
						},1800)
					}
				})
			},
			back(){
				uni.switchTab({
					url:"/pages/center/center"
				})
			}
			
		}
	}
</script>

<style>
.body {
		padding: 0 32rpx;
		min-height: 100vh;
		background-image: url('../../static/bgc.png');
		background-size: 100% 100%;
		background-repeat: no-repeat;
	}
.item {
		display: flex;
		padding: 24rpx;
		padding-top: 50rpx;
		align-items: center;
		position: relative;
		/* justify-content: space-between; */
		border-bottom: 1px solid #fafafa;
	}

	.block {
		width: 100%;
		height: auto;
		border-bottom: 24rpx solid #F1F6FB;
		padding: 0 32rpx 32rpx;
		box-sizing: border-box;
		background-color: #FFFFFF;
	}

	.title {
		width: 160rpx;
		margin-right: 30rpx;
		font-family: 'PingFang SC';
		font-style: normal;
		font-weight: 400;
		font-size: 28rpx;
		line-height: 40rpx;
		color: rgba(51, 51, 51, 0.4);
		text-align: left;
	}
	.button {
		position: absolute;
		bottom: 40rpx;
		width: 95%;
		left: 50%;
		transform: translateX(-50%);
		color: #fff;
		background-color: #07b1ff;
		padding: 32rpx;
		border-radius: 64rpx;
		text-align: center;
	}
</style>
